package com.kasax.plugin.shadow

import com.kasax.plugin.shadow.transform.TestTransform
import com.kasax.plugin.shadow.utils.LogUtils
import org.gradle.api.Plugin
import org.gradle.api.Project

class TestAppPlugin implements Plugin<Project> {
    private static final String LOG_TAG = "TestPlugin"

    void apply(Project project) {
        LogUtils.d(LOG_TAG, "apply")

        if (project.plugins.hasPlugin(AppPlugin)) {
            LogUtils.d(LOG_TAG, "use in app")
            LogUtils.d(LOG_TAG, "registerTransform")
            def appExtension = project.extensions.getByType(AppExtension)
            LogUtils.d(LOG_TAG, "prepare exec registerTransform")
            appExtension.registerTransform(new TestTransform())
            LogUtils.d(LOG_TAG, "registerTransform complete")
        }
    }
}